"""
TensorBorad可视化
"""
import tensorflow as tf

'''清除default graph和不断增加的节点'''
tf.compat.v1.reset_default_graph()

'''log路径'''
log_dir = "D:/Code/PycharmProjects/tensor_flow_Learning/src/log"

'''定义计算图, 实现向量加法操作'''
input1 = tf.constant([1.0, 2.0, 304], name="input1")
input2 = tf.Variable(tf.random.uniform([3]), name="input2")
output = tf.add_n([input1, input2], name="add")

'''生成一个写日志的writer, 并将当前的TensorFlow计算图写入日志'''
writer = tf.compat.v1.summary.FileWriter(log_dir, tf.compat.v1.get_default_graph())
writer.close()


'''命令行中输入 tensorboard --logdir=/path/log'''
